package columns

import (
	"github.com/gin-gonic/gin"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/app/ginsrv/oplog"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/core"
)

// Init 初始化
func Init(route *gin.RouterGroup, d core.CmsDomain) {
	column := createColumnCtrl(d)
	cr := route.Group("columns")
	cr.GET("", oplog.OplogRoute("cms/columns/list", "获取栏目的顶级列表", column.getColumnPageList))
	cr.POST("", oplog.OplogRoute("cms/columns/add", "新增栏目", column.add))
	cr.DELETE(":columnid", oplog.OplogRoute("cms/columns/delete", "删除栏目", column.delete))
	cr.GET(":columnid/children", oplog.OplogRoute("cms/columns/children", "获取栏目的子栏目", column.getColumnChildren))
	cr.PUT(":columnid/desc", oplog.OplogRoute("cms/columns/update/desc", "修改栏目基本信息", column.updateDesc))
	cr.GET(":columnid/desc", oplog.OplogRoute("cms/columns/desc", "获取栏目的描述信息", column.getColumnDesc))
	cr.PUT(":columnid/ctrl", oplog.OplogRoute("cms/columns/update/ctrl", "修改栏目控制参数", column.updateCtrl))
	cr.GET(":columnid/ctrl", oplog.OplogRoute("cms/columns/ctrl", "获取栏目的控制参数信息", column.getColumnCtrl))
	cr.GET(":columnid/extra", oplog.OplogRoute("cms/columns/extra", "获取栏目的扩展属性信息", column.getColumnExtra))
	cr.PUT(":columnid/extra", oplog.OplogRoute("cms/columns/update/extra", "修改栏目扩展属性", column.updateExtra))
	cr.PUT(":columnid/unlock", oplog.OplogRoute("cms/columns/unlock", "解锁栏目", column.unlock))
	cr.PUT(":columnid/lock", oplog.OplogRoute("cms/columns/lock", "锁定栏目", column.lock))
	cr.GET(":columnid", oplog.OplogRoute("cms/columns/getone", "获取指定栏目的信息", column.getColumn))
	cr.DELETE(":columnid/destroy", oplog.OplogRoute("cms/column/destroy", "彻底删除栏目", column.destroy))
	cr.PUT(":columnid/recover", oplog.OplogRoute("cms/column/recover", "恢复栏目", column.recover))
	route.GET("columntrees/sys", oplog.OplogRoute("cms/columntrees/sys", "获取系统栏目树", column.getColumnTreeForSys))
	route.GET("columntrees/org/:org", oplog.OplogRoute("cms/columntrees/org", "获取指定组织的栏目树", column.getColumnTreeForOrg))
	route.GET("columntrees/owner/:owner", oplog.OplogRoute("cms/columntrees/owner", "获取指定用户的栏目树", column.getColumnTreeForOwner))
	route.GET("columntrees/self", oplog.OplogRoute("cms/columntrees/self", "获取当前用户的栏目树", column.getColumnTreeForSelf))
	route.GET("extratypes", oplog.OplogRoute("cms/extratypes", "获取栏目可以支持的所有扩展类型", column.getExtraTypeAll))
	route.GET("extratypes/:code", oplog.OplogRoute("cms/extratypes/one", "获取指定的扩展类型", column.getExtraTypeOne))
}
